﻿@{
    ViewBag.Title = "ABM";
}

<style type="text/css">
table thead.miNombre 
{
	font:15px arial;
	background-color: black;
	color: yellow;
}

td 
{
	border: 1px solid grey;
    background-color: red;
    color: white;
}


</style>

<h1>ABM</h1>
<p><a href="@Url.Action("Home")">Home</a></p>
<p><a href="@Url.Action("Changuito")">Changuito</a></p>
<h2>Agregar</h2>
  <form action="/Electro/Agregar" method="post">

  @{
      string[] names = Enum.GetNames(typeof(CasaElectronica.Controllers.Categoria));    
  }

<label>
  <span>Categoria</span>
  <select name="categoria">
    @for (int i = 0; i<names.Length; i++) 
    {
        var s = names[i];
        <option value="@i">@s</option>
    }
    </select>
</label>
    <br />
    <label>
      <span>Nombre</span>
      <input type="text" name="nombre" value=""/>
    </label>
    <br />
    <label>
      <span>Precio</span>
      <input type="text" name="precio" value=""/>
    </label>
    <br />
    <label>
      <span>Cantidad</span>
      <input type="number" name="cantidad" />
    </label>
    <br />
    <input type="submit" value="Agregar" />
  </form>
  
    <!-- HEADING 2 == Titulo segundo -->
  <h2 class="otrotitulo">Lista actual</h2>

  <table  >
    <thead class="miNombre">
    <tr>
      <th>Nombre</th>
      <th>Categoria</th>
      <th>Precio</th>
      <th>Cantidad</th>
      <th>Operaciones</th>
    </tr>
    </thead>

    <tbody>
            
@{
    int co = 0;
    foreach (var i in Model)
    {
      <tr>
        <td>@i.nombre</td>
        <td>@i.categoria</td>
        <td>@i.precio</td>
        <td>@i.cantidad</td>
        <td>
            <a href="@Url.Action("Borrar")?pos=@co">Borrar Item</a>
            <a href="@Url.Action("Modificar")?pos=@co">Modificar Item</a>
        </td>
      </tr>
       co++;
    }
}
        
      
      
    </tbody>

<!--    <tfoot>
      <tr>
        <th colspan="4"></th>
      </tr>
    </tfoot>
-->
  </table>